using System;
using JGSY.KingAOP.Aop.HelloWorld;
using JGSY.KingAOP.Aop.Logging;
using JGSY.KingAOP.Aop.ExceptionHandling;
using JGSY.KingAOP.Aop.TestData;

namespace KingAOPConsoleExample
{
    class Program
    {
        static void Main(string[] args)
        {
            // Hello World 示例
            dynamic helloWorld = new HelloWorld();
            helloWorld.HelloWorldCall();

            // 日志记录示例
            var entity = new TestEntity { Name = "Jon", Number = 99 };
            dynamic repository = new TestRepository();
            repository.Save(entity);

            // 异常处理示例
            dynamic publicService = new PublicService
            {
                ServiceName = "TestService",
                Port = 1234,
                SessionId = "123908sdfhjkgdfg"
            };

            try
            {
                publicService.Send(entity);
            }
            catch (Exception ex)
            {
                Console.WriteLine("We catched original exception after 'exception aspect' did his job.");
            }

            Console.Read();
        }
    }
}    